<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>讯飞</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f9f4e8; /* 更改背景颜色为浅黄色 */
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
        }

        h1 {
            color: #553311; /* 更改标题颜色为深棕色 */
            margin-bottom: 20px;
        }

        .container {
            background-color: #fffbf5; /* 更改容器背景颜色为浅桃色 */
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 300px;
            text-align: center;
        }

        input[type="text"] {
            width: calc(100% - 22px);
            padding: 10px;
            margin-bottom: 10px;
            border: 1px solid #d3b69d; /* 更改边框颜色为浅棕色 */
            border-radius: 4px;
            box-sizing: border-box;
        }

        button {
            padding: 10px 20px;
            background-color: #ff9966; /* 更改按钮背景颜色为橙色 */
            color: #fff;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        button:hover {
            background-color: #ff6633; /* 更改按钮悬停时的背景颜色为深橙色 */
        }

        #response {
            margin-top: 20px;
            font-size: 16px;
            color: #8b5a2b; /* 更改回复文本颜色为棕色 */
        }
    </style>
    <script>
        function askQuestion() {
            var question = document.getElementById("question").value;
            fetch("/ask", {
                method: "POST",
                headers: {
                    "Content-Type": "application/json"
                },
                body: JSON.stringify({ question: question })
            })
            .then(response => response.json())
            .then(data => {
                document.getElementById("response").innerHTML = "回复: " + data.answer;
            });
        }
    </script>
</head>
<body>
    <div class="container">
        <h1>问答小能手</h1>
        <input type="text" id="question" placeholder="你好，请输入">
        <button onclick="askQuestion()">提问</button>
        <p id="response"></p>
    </div>
</body>
</html>